Add cloud credential serialization package#18
Closed
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Closed
Add cloud credential serialization package#18devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
Conversation
- Support serialization to/from bytes, string, and JSON formats - Provider registry system for automatic credential reconstruction - Comprehensive test coverage for all provider types - Round-trip serialization/deserialization support - SerializableCredential interface for extensible serialization - Validation and error handling for all credential types Co-Authored-By: Alec Fong <alecsanf@usc.edu>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
theFong
requested changes
Aug 9, 2025
Member
theFong
left a comment
There was a problem hiding this comment.
this seems directionally right, however lets reuse the Credential data type in each of the internal/{provider} implementation. We can move this package into internal/
pkg/v1/serialization.go
Outdated
|
|
||
| func DeserializeCredentialByProvider(providerID string, data json.RawMessage) (CloudCredential, error) { | ||
| switch providerID { | ||
| case "lambda-labs": |
Member
There was a problem hiding this comment.
lets use the actual provider ids found in the provider impl
- Move serialization package from pkg/v1/ to internal/serialization/v1/ - Add JSON tags to existing credential structs in provider packages - Use actual provider ID constants instead of hardcoded strings - Update deserialization to construct actual credential objects - Remove old pkg/v1/serialization files - Maintain all existing functionality and test coverage Co-Authored-By: Alec Fong <alecsanf@usc.edu>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Address PR feedback: refactor cloud credential serialization to internal/
Summary
This PR addresses the GitHub PR feedback on #18 by implementing three major refactoring changes to the cloud credential serialization package:
pkg/v1/tointernal/serialization/v1/to make it internal-onlyLambdaLabsCredential,FluidStackCredential,NebiusCredential)lambdalabsv1.CloudProviderID,fluidstackv1.CloudProviderID, "nebius")The refactoring maintains all existing serialization functionality while improving code reuse and consistency. JSON tags were added to the existing credential structs to enable serialization without creating duplicate data structures.
Review & Testing Checklist for Human
LambdaLabsCredential,FluidStackCredential, andNebiusCredentialdoesn't affect their usage elsewhere in the codebaselambdalabsv1.CloudProviderID("lambda-labs"),fluidstackv1.CloudProviderID("fluidstack"), and "nebius" match the previously hardcoded stringsinternal/aligns with the intended API design (package no longer available to external consumers)Recommended test plan: Create credential objects for each provider, serialize them using the new package, deserialize them back, and verify the round-trip preserves all data correctly.
Diagram
%%{ init : { "theme" : "default" }}%% graph TD subgraph "Old Structure (Deleted)" OldSer["pkg/v1/serialization.go"]:::major-edit OldTest["pkg/v1/serialization_test.go"]:::major-edit end subgraph "New Structure (Created)" NewSer["internal/serialization/v1/serialization.go"]:::major-edit NewTest["internal/serialization/v1/serialization_test.go"]:::major-edit end subgraph "Provider Packages (Modified)" Lambda["internal/lambdalabs/v1/client.go<br/>LambdaLabsCredential"]:::minor-edit Fluid["internal/fluidstack/v1/client.go<br/>FluidStackCredential"]:::minor-edit Nebius["internal/nebius/v1/client.go<br/>NebiusCredential"]:::minor-edit end subgraph "Core Interface (Context)" Core["pkg/v1/client.go<br/>CloudCredential interface"]:::context end NewSer -->|"imports & uses"| Lambda NewSer -->|"imports & uses"| Fluid NewSer -->|"imports & uses"| Nebius Lambda -->|"implements"| Core Fluid -->|"implements"| Core Nebius -->|"implements"| Core subgraph Legend L1[Major Edit]:::major-edit L2[Minor Edit]:::minor-edit L3[Context/No Edit]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
SerializableCredentialinterface is preserved for backward compatibility but now works with actual credential structsLink to Devin run: https://app.devin.ai/sessions/fee5d20f847747759938c50465de86cb
Requested by: Alec Fong (@theFong)